/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package be.ugent.medirem.logic;

import be.ugent.medirem.persistence.entity.details.ConsultationDetails;
import be.ugent.medirem.persistence.entity.details.GpDetails;
import be.ugent.medirem.persistence.entity.details.LocationDetails;
import be.ugent.medirem.persistence.entity.details.PatientDetails;
import be.ugent.medirem.persistence.entity.values.ConsultationValues;
import be.ugent.medirem.persistence.entity.values.GpValues;
import be.ugent.medirem.persistence.entity.values.LocationValues;
import be.ugent.medirem.persistence.exception.EntityNotFoundException;
import java.util.List;
import javax.annotation.security.RolesAllowed;
import javax.ejb.Remote;

/**
 *
 * @author Thomas Roelens
 */
@Remote
public interface GpRemote {

    @RolesAllowed("admin")
    Long create(GpValues gp) throws IllegalArgumentException;

    @RolesAllowed({"gp","patient"})
    GpDetails getDetails(Long id) throws EntityNotFoundException, IllegalArgumentException;

    @RolesAllowed("gp")
    void update(GpValues gp) throws EntityNotFoundException, IllegalArgumentException;

    @RolesAllowed("gp")
    void updateGpLocation(Long gpId, Long locationIdToUpdate, LocationValues locationDetails) throws EntityNotFoundException, IllegalArgumentException;

    @RolesAllowed("gp")
    void updatePassword(Long id, String old, String password) throws EntityNotFoundException, IllegalArgumentException;

    @RolesAllowed({"gp","patient"})
    LocationDetails getLocation(Long gpId) throws EntityNotFoundException, IllegalArgumentException;

    @RolesAllowed("gp")
    List<PatientDetails> getPatients(Long id) throws EntityNotFoundException, IllegalArgumentException;

    @RolesAllowed("gp")
    void addPatient(Long id, Long patientId) throws EntityNotFoundException, IllegalArgumentException;

    @RolesAllowed("gp")
    Long getGpId(String username) throws IllegalArgumentException;

    @RolesAllowed("gp")
    Long makeConsultation(ConsultationValues values) throws EntityNotFoundException, IllegalArgumentException;

    @RolesAllowed("gp")
    ConsultationDetails getLastConsultation(Long gpId, Long patientId);

    @RolesAllowed("gp")
    ConsultationDetails getNextConsultation(Long gpId, Long patientId);

    @RolesAllowed("gp")
    List<ConsultationDetails> getConsultations(Long id);

    @RolesAllowed("gp")
    boolean hasPatient(Long id, Long patient);
}
